package com.googlecode.websword.rest.utils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public abstract class RestRequestContext {
    private static ThreadLocal<HttpServletRequest> request = new ThreadLocal<HttpServletRequest>();
    private static ThreadLocal<HttpServletResponse> response = new ThreadLocal<HttpServletResponse>();
    
    public static HttpServletRequest getRequest() {
        return request.get();
    }
    public static void setRequest(HttpServletRequest request) {
        RestRequestContext.request.set(request);
    }
    
    public static HttpServletResponse getResponse() {
        return response.get();
    }
    public static void setResponse(HttpServletResponse response) {
        RestRequestContext.response.set(response);
    }

    public static void clear(){
        request.remove();
        response.remove();
    }
}
